/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadastroLayout.java
 *
 * Created on 27/11/2011, 21:29:53
 */
package acervo.view;

import java.awt.CardLayout;
import java.awt.Component;

/**
 *
 * @author Fernando
 */
public class Principal extends javax.swing.JFrame {
   
    
    /** Creates new form CadastroLayout */
    public Principal() {
        initComponents();        
    }

    private void setTela (Component tela, String ident){
        panelCard.add(tela, ident);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelCard = new javax.swing.JPanel();
        menuBar = new javax.swing.JMenuBar();
        menuMidias = new javax.swing.JMenu();
        imCadastro = new javax.swing.JMenuItem();
        imPesquisa = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Cadastro de Mídias");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setResizable(false);
        getContentPane().setLayout(null);

        panelCard.setLayout(new java.awt.CardLayout());
        getContentPane().add(panelCard);
        panelCard.setBounds(0, 0, 600, 430);
        this.setTela(new TelaInicial(), "cardInicial");
        this.setTela(new CadastroMidias(), "cardCadastro");
        this.setTela(new PesquisaMidias(), "cardPesquisa");

        menuMidias.setText("Mídias");

        imCadastro.setText("Cadastro");
        imCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                imCadastroActionPerformed(evt);
            }
        });
        menuMidias.add(imCadastro);

        imPesquisa.setText("Pesquisa");
        imPesquisa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                imPesquisaActionPerformed(evt);
            }
        });
        menuMidias.add(imPesquisa);

        menuBar.add(menuMidias);

        setJMenuBar(menuBar);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void imCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imCadastroActionPerformed
      CardLayout cl = (CardLayout) panelCard.getLayout();
      cl.show(panelCard, "cardCadastro");
}//GEN-LAST:event_imCadastroActionPerformed

private void imPesquisaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imPesquisaActionPerformed
      CardLayout cl = (CardLayout) panelCard.getLayout();
      cl.show(panelCard, "cardPesquisa");
}//GEN-LAST:event_imPesquisaActionPerformed

    /**
     * @param args the command line arguments
     */    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem imCadastro;
    private javax.swing.JMenuItem imPesquisa;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenu menuMidias;
    private javax.swing.JPanel panelCard;
    // End of variables declaration//GEN-END:variables
    
}

